package com.mzj.saas.mservice.sys.controller;

import com.mzj.saas.commons.ResultBean;
import com.mzj.saas.mservice.department.vo.DepartmentVO;
import com.mzj.saas.mservice.sys.service.CompanyMessageService;
import com.mzj.saas.mservice.sys.vo.CompanyAreaTimeZoneVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * 企业信息设置
 */
@Controller
@RequestMapping("/message")
public class CompanyMessageController {
    private static final Logger LOG = LoggerFactory.getLogger(CompanyMessageController.class);
    @Autowired
    private CompanyMessageService companyMessageService;

    /*
     *企业设置
     * name
     * description
     * icon
     */
    @PostMapping("companySet")
    @ResponseBody
    public ResultBean<Object> companySet(@RequestHeader String accessToken, DepartmentVO departmentVO, @RequestParam(value = "file", required = false) MultipartFile file) {
        return companyMessageService.companySet(accessToken, departmentVO, file);
    }

    /*
     *显示企业信息
     */
    @PostMapping(value = "findCompanyInfo")
    @ResponseBody
    public ResultBean<Object> findCompanyInfo(@RequestHeader String accessToken) {
        return companyMessageService.findCompanyInfo(accessToken);
    }

    /*
     *公租房公示设置-(暂时不做)
     */
    @PostMapping(value = "setPassPublicHousePermission")
    @ResponseBody
    public ResultBean<Object> setPassPublicHousePermission(@RequestHeader String accessToken, @RequestParam(name = "permissionId", required = false) Long permissionId) {
        return companyMessageService.setPassPublicHousePermission(accessToken, permissionId);
    }

    /*
     *地区列表显示
     */
    @PostMapping(value = "globalAreaList")
    @ResponseBody
    public ResultBean<Object> globalAreaList(@RequestHeader String accessToken) {
        return companyMessageService.globalAreaList(accessToken);
    }

    /*
     *时区列表显示
     */
    @PostMapping(value = "globalTimeZone")
    @ResponseBody
    public ResultBean<Object> globalTimeZone(@RequestHeader String accessToken) {
        return companyMessageService.globalTimeZone(accessToken);
    }

    /*
     *企业时区保存
     */
    @PostMapping(value = "setSysTimeZoneArea")
    @ResponseBody
    public ResultBean<Object> setSysTimeZoneArea(@RequestHeader String accessToken,CompanyAreaTimeZoneVO companyAreaTimeZoneVO) {
        return companyMessageService.setSysTimeZoneArea(accessToken, companyAreaTimeZoneVO);
    }
    /*
    *获取当前企业地区时区信息
     */
    @PostMapping(value = "presentCompanyAreaAndTimeZoneInfo")
    @ResponseBody
    public ResultBean<Object> presentCompanyAreaAndTimeZoneInfo(@RequestHeader String accessToken) {
        return companyMessageService.presentCompanyAreaAndTimeZoneInfo(accessToken);
    }
}
